﻿namespace PasswordGenerator.Generator
{
    using System;

    public class RandomCryptoProvider : ICryptoProvider
    {
        private readonly Random rand;

        public RandomCryptoProvider()
        {
            this.rand = new Random();
        }

        public uint GetNext(uint minValue, uint maxValue)
        {
            if (minValue > int.MaxValue)
            {
                throw new InvalidOperationException("minValue must be less than int.MaxValue!");
            }

            if (maxValue > int.MaxValue)
            {
                throw new InvalidOperationException("maxValue must be less than int.MaxValue!");
            }

            return (uint)rand.Next((int)minValue, (int)maxValue);
        }
    }
}
